#include "Strategy.h"
#include <fstream>
using namespace std;

class A1 : public Strategy 
{
public:
	void on_init(const nlohmann::json config)
	{
	}

	void on_process(const Ticker* t)
	{
		fprintf(stderr,"%s %s %3d %.3f - %.3f %3d\n",Timer::nano2str(t->last.nano).c_str(), t->name, t->last.BidVolume1, t->last.BidPrice1*0.001,t->last.AskPrice1*0.001, t->last.AskVolume1);
	}
};

int main(int argc, char **argv)
{
	string config_file = "strategy.json";
	if(argc > 1)
		config_file = argv[1];
	ifstream in(config_file);
    string content((istreambuf_iterator<char>(in)), istreambuf_iterator<char>());
	in.close();
	nlohmann::json config = nlohmann::json::parse(content);
	shared_ptr<A1> a = make_shared<A1>();
	if(a->init(config))
		a->run();
	return 0;
}
